package per.jdz.demo.utils;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.metadata.data.WriteCellData;
import per.jdz.demo.enums.RoomStatus;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Jdz
 * @date 2025/1/7
 */
public class SaleStatusConverter implements Converter<String> {
    @Override
    public String convertToJavaData(ReadConverterContext<?> context) {
        return RoomStatus.fromDisplayValue(context.getReadCellData().getStringValue());
    }

    @Override
    public WriteCellData<?> convertToExcelData(WriteConverterContext<String> context) throws Exception {
        return new WriteCellData<>(context.getValue());
    }
}
